﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Security.Claims;
using System.Text;

namespace Cms.Core.Infrastructure.Dependency
{
    [Dependency(ServiceLifetime.Scoped,AddSelf =true)]
    public  class ScopedDictionary : ConcurrentDictionary<string, object>,IDisposable
    {

        /// <summary>
        /// 获取或设置 当前用户
        /// </summary>
        public ClaimsIdentity Identity { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public bool IsAdmin { get; set; }

        public void Dispose()
        {
            Identity = null;
            this.Clear();
        }
    }
}
